/*************************************************************************
	> File Name: 1.test.c
	> Author: 
	> Mail: 
	> Created Time: 2021年01月23日 星期六 14时26分52秒
 ************************************************************************/

#include "head.h"

struct MyArg {
    char name[20];
    int age;
};

void *print(void *arg) {
    printf("In Thread\n");
    struct MyArg *in = (struct MyArg *)arg;
    struct MyArg in1 = *(struct MyArg *)arg; 
    // printf("%s is %d years old\n", ((struct MyArg *)arg)->name, ((struct MyArg *)arg)->age);
    // printf("%s is %d years old\n", in->name, in->age);
    printf("%s is %d years old\n", in1.name, in1.age);
}

int main() {
    struct MyArg arg;
    pthread_t thread;
    char name[20];
    int age = 18;
    strcpy(name, "wyf");

    strcpy(arg.name, "wyf");
    arg.age = age;

    pthread_create(&thread, NULL, print, &arg);

    usleep(100000);

    return 0;
}

